﻿<UserControl x:Class="Lessons.Lesson1.Example"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:pivot="clr-namespace:System.Windows.Pivot;assembly=System.Windows.Pivot"
    xmlns:local="clr-namespace:Lessons.Lesson1"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <Style TargetType="pivot:PivotViewer">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect Opacity="0.3" ShadowDepth="3" BlurRadius="3"/>
                </Setter.Value>
            </Setter>
         </Style>
        <Style x:Name="InfoPanelStyle" TargetType="Border">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Effect">
                <Setter.Value>
                    <DropShadowEffect Opacity="0.3" ShadowDepth="3" BlurRadius="3"/>
                </Setter.Value>
            </Setter>
            <Setter Property="Width" Value="250"/>
            <Setter Property="Background" Value="#FFf5f7f9"/>
            <Setter Property="BorderBrush" Value="#FFd3d4d4"/>
            <Setter Property="BorderThickness" Value="1"/>
        </Style>
        <Style x:Name="InfoPanelContainerStyle" TargetType="StackPanel">
            <Setter Property="Margin" Value="5"/>
        </Style>
        <Style x:Name="InfoPanelSectionStyle" TargetType="StackPanel">
            <Setter Property="Margin" Value="0,0,0,20"/>
        </Style>
        <Style x:Name="InfoScrollStyle" TargetType="ScrollViewer">
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="260"/>
        </Grid.ColumnDefinitions>
        <pivot:PivotViewer x:Name="pvLesson1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

        <Border Grid.Column="1" Style="{StaticResource InfoPanelStyle}">
            <ScrollViewer VerticalScrollBarVisibility="Auto">
                <StackPanel Style="{StaticResource InfoPanelContainerStyle}">

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Collection Name"/>
                        <TextBox IsReadOnly="True" Text="{Binding CollectionName, ElementName=pvLesson1}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Collection Item Count"/>
                        <TextBox IsReadOnly="True" Text="{Binding CollectionItemCount, ElementName=pvLesson1}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Collection Uri"/>
                        <TextBox IsReadOnly="True" Text="{Binding CollectionUri, ElementName=pvLesson1}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Pivot Viewer Events"/>
                        <ListBox Height="100" ItemsSource="{Binding Events}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Current Item"/>
                        <TextBox IsReadOnly="True" Text="{Binding CurrentItemId, ElementName=pvLesson1}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Current Item"/>
                        <ListBox Height="100" ItemsSource="{Binding InScopeItemIds, ElementName=pvLesson1}"/>
                    </StackPanel>

                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Sort Category"/>
                        <TextBox IsReadOnly="True" Text="{Binding SortFacetCategory, ElementName=pvLesson1}"/>
                    </StackPanel>
                    
                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="Filters"/>
                        <ListBox Height="100" ItemsSource="{Binding AppliedFilters, ElementName=pvLesson1}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <TextBlock FontWeight="Bold" Text="{Binding Key}"/>
                                        <ListBox BorderThickness="0" Margin="10,0,0,0" ItemsSource="{Binding Value}"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>


                    <StackPanel Style="{StaticResource InfoPanelSectionStyle}">
                        <TextBlock Text="View State"/>
                        <TextBox IsReadOnly="True" Height="100" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Text="{Binding ViewerState, ElementName=pvLesson1}"/>
                    </StackPanel>

                </StackPanel>

            </ScrollViewer>
        </Border>
    </Grid>
</UserControl>
